<template>
  <el-button
    :type="type"
    :class="[className, { 'primary-gradient': type === 'primary' }]"
    :loading="loading"
    @click="handleClick"
  >
    <slot />
  </el-button>
</template>

<script setup>
import { defineProps, defineEmits } from 'vue'

const props = defineProps({
  type: {
    type: String,
    default: 'default'
  },
  className: {
    type: String,
    default: ''
  },
  loading: {
    type: Boolean,
    default: false
  }
})

const emits = defineEmits(['click'])

const handleClick = (event) => {
  emits('click', event)
}
</script>

<style scoped>
.primary-gradient {
  background: linear-gradient(135deg, #3b82f6, #1d4ed8);
  border: none;
  color: white;
  font-weight: 500;
  position: relative;
  overflow: hidden;
}

.primary-gradient::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: left 0.6s ease;
}

.primary-gradient:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(59, 130, 246, 0.3);
}

.primary-gradient:hover::before {
  left: 100%;
}

.default-gradient {
  background: linear-gradient(135deg, #f8fafc, #e2e8f0);
  border: 1px solid rgba(226, 232, 240, 0.8);
  color: #334155;
}

.default-gradient:hover {
  background: #fff;
  border-color: #409eff;
  color: #409eff;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(64, 158, 255, 0.15);
}
</style>